package net.exoweb.animate.objects
{
    public class Vector
    {
        private var _x:Number;
        private var _y:Number;

        public function Vector(x:Number=0, y:Number=0)
        {
            _x = x;
            _y = y;
        }

        public function set x(v:Number):void
        {
            _x = v;
        }

        public function get x():Number
        {
            return _x;
        }

        public function set y(v:Number):void
        {
            _y = v;
        }

        public function get y():Number
        {
            return _y;
        }

        public function equal(v:Vector):void
        {
            _x = v.x;
            _y = v.y;
        }

        public function plus(v:Vector):void
        {
            _x += v.x;
            _y += v.y;
        }

        public function minus(v:Vector):void
        {
            _x -= v.x;
            _y -= v.y;
        }

        public function dotProduct(v:Vector):Number
        {
            return (_x * v.x) + (_y * v.y);
        }

        public function crossProduct(v:Vector):Number
        {
            return (_x * v.y) - (_y * v.x);
        }

        public function print():void
        {
            trace("Vector = (" + _x.toString() + ", " + _y.toString() + ")");
        }
    }
}
